<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Modeling</title>
{:importCSS("template.css|style.css|work-single.css|font.css")}
{:importJS("jquery.min.js")}
</head>
<body>
<include file="public:header" />
<div class="main center clearfix">

	<div class="inforbox">
    	<div class="workname"><span class="strong">{$work.name|h}</span></div>
    	<span ID="favStatus">
        		{:favStatus($_cUser,$work['id'])}
        </span>
        <script>
        	function follow_func(url) {
        		$.getJSON(url,function(data) {
        			//console.log(data);
        			if (data.error > 0) {
        				alert(data.msg);
        			} else {
        				$("#favStatus").html(data.data); 
        			}
        		})
        	}
        	$(".action_follow").live("click",function() {
        		follow_func("{:U('/work/fav/add/'.$work['id'])}");
        	});
        	$(".action_cancel").live("click",function() {
        		follow_func("{:U('/work/fav/cancel/'.$work['id'])}");
        	});
        </script>
        <!--
        <a href="#"><div class=" button nofollow">CANCEL</div></a>
        <a href="#"><div class="follow button now">FOLLOW</div></a>
        -->
        <div class="clear"></div>
        <div class="border nameborder"></div>
        <div class="clear"></div>
        <div class="worksitupic bidding"></div><div class="worksitu"><span class="strong">{:L('WORK_BIDDING')}</span></div>
        <div class="clear"></div>
        <div class="workset">{:L('WORK_OWNER')} : <span class="strong">David</span></div>
        <div class="clear"></div>
        <div class="worktime">{:L('WORK_END_TIME')} : <span class="strong">{:date('Y-m-d',$work['endtime'])}</span></div>
        <div class="clear"></div>
        <div class="workbud">{:L('CONTRACTOR_BUDGET')} : <span class="strong">$ {$work.budget|h}</span></div>
        <div class="clear"></div>
        <div class="workaim">{:L('WORK_AIM')} : <span class="strong">{$work.aim|h}</span></div>
        <div class="clear"></div>
        <div class="worksummary">{:L('WORK_OVERVIEW')} : <span>{$work.overview|h}</span></div>
        <div class="clear"></div>
        <div class="border"></div>
        <div class="clear"></div>
        <div class="workinvo">{:L('WORK_INVOICE_REQUIRED')} : <span class="strong">{$work['op_receipt']?"YES":"NO"}</span></div>
        <div class="clear"></div>
        <div class="workin">{:L('WORK_DAILY_REPORT')} : <span class="strong">{$work['op_report']?"YES":"NO"}</span></div>
        <div class="clear"></div>
        <div class="workin">{:L('WORK_CASE_REQUIRED')} : <span class="strong">{$work['op_havedemo']?"YES":"NO"}</span></div>
        <div class="clear"></div>
        <div class="workin">{:L('WORK_ONLINE_PAYMENT')} : <span class="strong">{$work['op_netpay']?"YES":"NO"}</span></div>
        <div class="clear"></div>
        <div class="workcer">{:L('WORK_CERTIFICATION')} : <span class="strong">{$work['op_verify']?"YES":"NO"}</span></div>
        <div class="clear"></div>
    </div>
    
    <div class="bidbox">
    	<div class="bidsend">
    		<form id=bids_form method=post enctype="multipart/form-data">
        	<div class="upfile"><input type="file" name="attach" /></div><div id="upfile"></div>
        	<textarea type="text" id="word" name="content" onfocus="if(value=='{:L('WORK_MESSAGES')}'){value=''}; setStyleOne(this.id)" onblur="if(value==''){ value='{:L('WORK_MESSAGES')}' }; setStyleTwo(this.id)" <php> if ($_cUser) { </php> >{:L('WORK_MESSAGES')}<php> } else { </php> disabled  > PLEASE LOGIN FIRST  <php> } </php></textarea>
            <input type="text" id="money" name="money" value="Bid price" onfocus="if(value=='Bid price') {value=''} setStyleOne(this.id)" onblur="if (value=='') {value='Bid price'} setStyleTwo(this.id)"/>
            <div class="clear"></div>
            <php> if ($_cUser) { </php>
            	<a href="#" onclick="return $('#bids_form').submit();"><div class="button bidbutton">{:L('WORK_BID')}</div></a>
            <php> } else {</php>
            	<a href="{:U('/signin')}"><div class="button bidbutton">{:L('WORK_BID')}</div></a>
            <php> } </php>
            <input type="hidden" name="action" value="bid"/>
            <div class="clear"></div>
            </form>
        </div>
        <div class="clear"></div>
        <div class="bidtitle">{:L('WORK_BIDDING')}</div>
        <div class="clear"></div>
    	<div class="bidlist">
    		<div class="listhead">
        		<div class="lhname">{:L('WORK_NAME')}</div>
            	<div class="lhcountry">{:L('WORK_COUNTRY')}</div>
            	<div class="lhtimes">{:L('WORK_TALK_TIMES')}</div>
        	</div>
        	<div class="clear"></div>
        	<table>
        		<volist name="bider" id="vo">
        		<tr class="bidlistsingle">
    				<td class="bidname"><a href="{:U('/contractor/view/'.$vo['uid'])}">{$vo.username}</a></td>
            		<td class="bidcountry">{:M('country')->getFieldByCode($vo['country'],"en")}</td>
            		<td class="bidtimes">{:msgcount($work['id'],$vo['uid'])}</td>
        		</tr>
        		</volist>
        		<!--
                <tr class="bidlistsingle">
    				<td class="bidname"><a href="contractor-single.html">David</a></td>
            		<td class="bidcountry">China</td>
            		<td class="bidtimes">20</td>
        		</tr>
                <tr class="bidlistsingle">
    				<td class="bidname"><a href="contractor-single.html">David</a></td>
            		<td class="bidcountry">China</td>
            		<td class="bidtimes">20</td>
        		</tr>-->
        	</table>
            <div class="clear"></div>
    	</div>
        <div class="clear"></div>
        <!--<a href="{:U('/work/view/'.$work['id'].'/bids')}"><div class="button choose">Choose the WORKER</div></a>-->
        <div class="clear"></div>
	</div>
    
    <div class="messagebox">
    	
    	<form id="message_form" method="post">
  		<div class="messagesend">
        	<div class="typebox">
            	<div class="inputimg"><img src="__ROOT__/themes/images/client-type.png" /></div>
                <div class="inputname">{:L('WORK_MESSAGE_TYPE')}</div>
                <div id="dropDownList1" class="dropDownList dropdown">
  					<select class="hide" name="type">
                    	<option value="0">{:L('WORK_PLEASE_SELECT')}</option>
   						<option value="1">{:L('WORK_ADVICE')}</option>
   						<option value="2">{:L('WORK_TECHNICAL_ADVICE')}</option>
   						<option value="3">{:L('WORK_FEATURE_SUGGESTIONS')}</option>
                    	<option value="4">{:L('WORK_PROTOTYPE_ADVICE')}</option>
                        <option value="5">{:L('WORK_OTHER')}</option>
  					</select>
  					<span class="">{:L('WORK_PLEASE_SELECT')}</span>
            		<ul class="">
            		</ul>
        		</div>
        	</div>
            <textarea type="text" id="message" name="message" onfocus="if(value=='{:L('WORK_MESSAGES')}'){value=''}; setStyleOne(this.id)" onblur="if(value==''){ value='{:L('WORK_MESSAGES')}' }; setStyleTwo(this.id)" <php> if ($_cUser) { </php> >{:L('WORK_MESSAGES')}<php> } else { </php> disabled  > {:L('WORK_PLEASE_LOGIN_FIRST')}  <php> } </php></textarea>
            <div class="clear"></div>
            <input type="hidden" name="action" value="message"/>
            <php> if ($_cUser) { </php>
            	<a href="#" onclick="$('#message_form').submit();"><div class="button messagebutton">{:L('WORK_SEND')}</div></a> 
            <php> } else {</php>
            	<a href="{:U('/signin')}"><div class="button messagebutton">{:L('WORK_SEND')}</div></a>
            <php> } </php>
            <div class="clear"></div>
        </div>
        </form>
        
        <div class="messagetitle">{:L('WORK_MESSAGES')} ({:msgcount($work['id'])})</div>
        <div class="clear"></div>
        <div class="messagelist">
        	<volist name="message" id="vo">
        	<div class="messagesingle">
            	<div class="pic"><img src="{:getAvatar($vo)}" width=50/></div>
                <div class="wordbox">
                	<div class="name"><a href="{:U('/contractor/view/'.$vo['uid'])}">{$vo.username}</a></div>
                	<div class="word">{$vo.content|h}</div>
                    <!--<div class="time"></div>-->
                </div>
                <div class="clear"></div>
            </div>
            <div class="clear"></div>
            </volist>
            <!--
            <div class="messagesingle">
            	<div class="pic"><img src="__ROOT__/themes/images/pimg.png" /></div>
                <div class="wordbox">
                	<div class="name"><a href="">David</a></div>
                	<div class="word">Sweet.</div>
                    <div class="time">14 minutes earlier</div>
                </div>
                <div class="clear"></div>
            </div>
            <div class="clear"></div>
            <div class="messagesingle">
            	<div class="pic"><img src="__ROOT__/themes/images/pimg.png" /></div>
                <div class="wordbox">
                	<div class="name"><a href="">David</a></div>
                	<div class="word">Sweet. I Love your style!</div>
                    <div class="time">14 minutes earlier</div>
                </div>
                <div class="clear"></div>
            </div>
            <div class="clear"></div>
            -->
        </div>
        <a href="{:U('/work/view/'.$work['id'].'/message')}"><div class="messagemore button">{:L('INDEX_MORE')}</div></a>
    </div>

</div>
<include file="public:footer" />
{:importJS("downlist.js|input.js|signup.js")}
</body>
</html>
